/*
 * ﻿Copyright (C) 2009-2013 NewMain Softech
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package com.newmainsoftech.gwetons.client;

import java.util.logging.Level;
import java.util.logging.Logger;

import com.google.gwt.core.client.JavaScriptException;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.junit.DoNotRunWith;
import com.google.gwt.junit.Platform;
import com.newmainsoftech.gwetons.logging.client.JsniLoggerWrapAdaptedGwtTestCase;
import com.newmainsoftech.gwetons.shared.logging.LoggerWrap;

/**
 * GWT JUnit tests must extend GWTTestCase.
 */
public class GwtTest_RegExpJsni extends JsniLoggerWrapAdaptedGwtTestCase {
	/**
	 * Must refer to a valid module that sources this class.
	 */
	public String getModuleName() {
		return "com.newmainsoftech.gwetons.GWeTons";
	}

	@Override
	protected String getNameForLogging() {
		return this.getClass().getName();
	}
	
	LoggerWrap loggerWrap;
	
	@Override
	protected void gwtSetUp() {
		if ( loggerWrap == null) {
			getLoggerInitializerForTest().setupLogger();
			
			loggerWrap = getJsniLoggerWrap().getLoggerWrap();
				loggerWrap.getLogger().setLevel( Level.ALL);

			Logger otherLogger = Logger.getLogger( RegExpJsniImpl.getNameForLogging());
				otherLogger.setLevel( Level.ALL);
		}
	}
	
	

	RegExpJsni regExpJsniObj = null;
	
	protected String inputStr = null;
	
	public void testLastIndex() {
		inputStr = "testLastIndex";
			regExpJsniObj = new RegExpJsniImpl( "st", false, false, false);
				assertTrue( regExpJsniObj.test( inputStr));
				assertEquals( -1, regExpJsniObj.getLastIndex());
				assertTrue( regExpJsniObj.test( inputStr));
				assertEquals( -1, regExpJsniObj.getLastIndex());
			regExpJsniObj = new RegExpJsniImpl( "st", false, true, false);
				assertEquals( "st", regExpJsniObj.exec( inputStr));
				assertEquals( 4, regExpJsniObj.getLastIndex());
				assertEquals( "st", regExpJsniObj.exec( inputStr));
				assertEquals( 8, regExpJsniObj.getLastIndex());
				
		inputStr = "teLaIndex";
				assertFalse( regExpJsniObj.test( inputStr));
				assertEquals( 0, regExpJsniObj.getLastIndex());
	}
	
	public void testStaticLastIndex() {
		inputStr = "com.inetools.regexpjsni.client.RegExpJsniTest";
		int lastIndex = RegExpJsniImpl.lastIndex( inputStr, "Inetools", false);
		assertEquals( 0, lastIndex);
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "inetools", true);
		String expectedMatchStr = "inetools";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);
		
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "\\.\\S+$", false);
		expectedMatchStr = ".RegExpJsniTest";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);

		// invalid argument test cases ------------------------------------------------------------
		boolean javaScriptExceptionFlag = false;
		try {
			lastIndex = RegExpJsniImpl.lastIndex( null, "\\.\\S+$", false);
		}
		catch( JavaScriptException exception) {
			javaScriptExceptionFlag = true;
		}
		assertTrue( javaScriptExceptionFlag);
		
		javaScriptExceptionFlag = false;
		try {
			lastIndex = RegExpJsniImpl.lastIndex( inputStr, null, false);
		}
		catch( JavaScriptException exception) {
			javaScriptExceptionFlag = true;
		}
		assertTrue( javaScriptExceptionFlag);
		// ----------------------------------------------------------------------------------------
		
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "<\\s*/{0,1}script[\\s>]", true);
		expectedMatchStr = "< script ";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "<\\s*/{0,1}script[\\s>]\\s*$", true);
		expectedMatchStr = "</script>";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);
		
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "\\bfunction\\b", true);
		expectedMatchStr = "(function";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);
		
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "\\.\\s*constructor\\s*\\b", true);
		expectedMatchStr = ".constructor";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);
		
		lastIndex = RegExpJsniImpl.lastIndex( inputStr, "\\.\\s*apply\\s*\\b", true);
		expectedMatchStr = ".apply";
		assertEquals( inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), lastIndex);
	}

	protected JavaScriptObject regExpObj = null;
	public void testTest() {
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
		assertFalse( RegExpJsniImpl.test( null, inputStr));
		
		regExpObj = RegExpJsniImpl.getRegExp( "\\.\\s*apply\\s*\\b", false, true);
		assertFalse( RegExpJsniImpl.test( regExpObj, null));
		assertFalse( RegExpJsniImpl.test( regExpObj, ""));

		assertTrue( RegExpJsniImpl.test( regExpObj, inputStr));
	}

	public void testGetLastIndex() {
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
		regExpObj = RegExpJsniImpl.getRegExp( "\\bfunction\\b", false, true);
		assertTrue( RegExpJsniImpl.test( regExpObj, inputStr));
		
		String expectedMatchStr = "(function";
		assertEquals( 
				inputStr.indexOf( expectedMatchStr) + expectedMatchStr.length(), 
				RegExpJsniImpl.getLastIndex( regExpObj)
				);
		
		assertTrue( RegExpJsniImpl.test( regExpObj, inputStr));
		assertEquals( 
				inputStr.lastIndexOf( expectedMatchStr) + expectedMatchStr.length(), 
				RegExpJsniImpl.getLastIndex( regExpObj)
				);
	}
	
	public void testGetSource() {
		boolean javaScriptExceptionFlag = false;
		try {
			RegExpJsniImpl.getSource( null);
		}
		catch( JavaScriptException exception) {
			javaScriptExceptionFlag = true;
		}
		assertTrue( javaScriptExceptionFlag);
		
		String regExpStr = "\\.\\s*constructor\\s*\\b";
		regExpObj = RegExpJsniImpl.getRegExp( regExpStr, true, true);
		assertEquals( regExpStr, RegExpJsniImpl.getSource( regExpObj));
	}
	
	public void testGetInput() {
		String inputStr1 = "testGetInput";
			regExpJsniObj = new RegExpJsniImpl( "[a-z]?t[a-z]?", true, true, false);
				assertNull( regExpJsniObj.getInput());
				assertTrue( regExpJsniObj.test( inputStr1));
				assertEquals( inputStr1, regExpJsniObj.getInput());
		String inputStr2 = "esGeInpu";
				assertFalse( regExpJsniObj.test( inputStr2));
				assertEquals( inputStr1, regExpJsniObj.getInput());
	}
	
	/**
	 * HtmlUnit seems not like supporting input property of global RegExp JavaScript object. 
	 * Thereby, this test needs to be performed by manual way to use actual browsers. 
	 * Since input property of global RegExp JavaScript object is deprecated, the priority 
	 * of this test is low.
	 */
	@DoNotRunWith( {Platform.HtmlUnitUnknown})
	public void manualTestStaticGetInputProperty() {
		String methodName = "manualTestStaticGetInputProperty test";
		loggerWrap.entering( methodName, null);
		
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
		regExpObj = RegExpJsniImpl.getRegExp( "\\bfunction\\b", false, true);
		assertTrue( RegExpJsniImpl.test( regExpObj, inputStr));
		assertEquals( inputStr, RegExpJsniImpl.getInputProperty());
		
		assertFalse( RegExpJsniImpl.test( regExpObj, "Haction"));
		assertEquals( inputStr, RegExpJsniImpl.getInputProperty());
		
		loggerWrap.exiting( methodName);
	}
	
	public void testGetGlobal() {
		inputStr = "testGetGlobal";
			regExpJsniObj = new RegExpJsniImpl( "g", true, false, false);
				assertFalse( regExpJsniObj.getGlobal());
				assertEquals( "G", regExpJsniObj.exec( inputStr));
				assertEquals( -1, regExpJsniObj.getLastIndex());
				assertEquals( "G", regExpJsniObj.exec( inputStr));
				assertEquals( -1, regExpJsniObj.getLastIndex());
			
			regExpJsniObj = new RegExpJsniImpl( "G", false, true, false);
				assertTrue( regExpJsniObj.getGlobal());
				assertEquals( "G", regExpJsniObj.exec( inputStr));
				assertEquals( 5, regExpJsniObj.getLastIndex());
				assertEquals( "G", regExpJsniObj.exec( inputStr));
				assertEquals( 8, regExpJsniObj.getLastIndex());
				assertNull( regExpJsniObj.exec( inputStr));
				assertEquals( 0, regExpJsniObj.getLastIndex());
	}
	
	public void testStaticGetGlobal() {
		boolean javaScriptExceptionFlag = false;
		try {
			RegExpJsniImpl.getGlobal( null);
		}
		catch( JavaScriptException exception) {
			javaScriptExceptionFlag = true;
		}
		assertTrue( javaScriptExceptionFlag);
		
		regExpObj = RegExpJsniImpl.getRegExp( "", true, true);
		assertTrue( RegExpJsniImpl.getGlobal( regExpObj));

		regExpObj = RegExpJsniImpl.getRegExp( "", false, false);
		assertFalse( RegExpJsniImpl.getGlobal( regExpObj));
	}
	
	public void testGetIgnoreCase() {
		inputStr = "testGetIgnoreCase";
			regExpJsniObj = new RegExpJsniImpl( "[a-z]e", false, true, false);
				assertFalse( regExpJsniObj.getIgnoreCase());
				assertEquals( "te", regExpJsniObj.exec( inputStr));
				assertEquals( "re", regExpJsniObj.exec( inputStr));
				assertEquals( "se", regExpJsniObj.exec( inputStr));
			regExpJsniObj = new RegExpJsniImpl( "[a-z]e", true, true, false);
				assertTrue( regExpJsniObj.getIgnoreCase());
				assertEquals( "te", regExpJsniObj.exec( inputStr));
				assertEquals( "Ge", regExpJsniObj.exec( inputStr));
				assertEquals( "re", regExpJsniObj.exec( inputStr));
				assertEquals( "se", regExpJsniObj.exec( inputStr));
	}
	
	public void testStaticGetIgnoreCase() {
		boolean javaScriptExceptionFlag = false;
		try {
			RegExpJsniImpl.getIgnoreCase( null);
		}
		catch( JavaScriptException exception) {
			javaScriptExceptionFlag = true;
		}
		assertTrue( javaScriptExceptionFlag);
		
		regExpObj = RegExpJsniImpl.getRegExp( "", true, true);
		assertTrue( RegExpJsniImpl.getIgnoreCase( regExpObj));

		regExpObj = RegExpJsniImpl.getRegExp( "", false, false);
		assertFalse( RegExpJsniImpl.getIgnoreCase( regExpObj));
	}
	
	public void testGetLastMatch() {
		inputStr = "testGetLastMatch";
			regExpJsniObj = new RegExpJsniImpl( "[a-z]t", false, true, false);
				String lastMatchedStr = null;
				int counter = 0;
				for( 
						String matchedStr = regExpJsniObj.exec( inputStr);
						matchedStr != null;
						matchedStr = regExpJsniObj.exec( inputStr)
						) 
				{
					counter++;
					lastMatchedStr = matchedStr;
					assertEquals( matchedStr, regExpJsniObj.getLastMatch());
				}
				assertEquals( 4, counter);
				assertEquals( lastMatchedStr, regExpJsniObj.getLastMatch());
				
		inputStr = "12345678";
				assertFalse( regExpJsniObj.test( inputStr));
				assertEquals( lastMatchedStr, regExpJsniObj.getLastMatch());
	}
	
	public void testStaticGetLastMatch() {
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
		regExpObj = RegExpJsniImpl.getRegExp( "\\bfunction\\b", false, true);
			String lastMatch = RegExpJsniImpl.exec( regExpObj, inputStr);
			assertNotNull( lastMatch);
			assertEquals( lastMatch, RegExpJsniImpl.getLastMatchProperty());
		
		regExpObj = RegExpJsniImpl.getRegExp( "123", false, true);
			assertFalse( RegExpJsniImpl.test( regExpObj, inputStr));
			assertEquals( lastMatch, RegExpJsniImpl.getLastMatchProperty());
	}
	
	public void testGetLeftContext() {
		inputStr = "testGetLeftContext";
			regExpJsniObj = new RegExpJsniImpl( "[A-Z]e", false, true, false);
				int counter = 0;
				String leftContext = null;
				for( 
						String matchedStr = regExpJsniObj.exec( inputStr);
						matchedStr != null;
						matchedStr = regExpJsniObj.exec( inputStr)
						) 
				{
					counter++;
					leftContext = regExpJsniObj.getLeftContext();
					assertEquals( 
							inputStr.substring( 0, regExpJsniObj.getLastIndex() - matchedStr.length()), 
							leftContext);
				} // for
				assertEquals( 2, counter);
				
			RegExpJsni regExpJsniObj2 = new RegExpJsniImpl( "[0-9]", false, true, false);
				assertFalse( regExpJsniObj2.test( inputStr));
				assertEquals( "", regExpJsniObj2.getLeftContext());
				assertEquals( leftContext, regExpJsniObj.getLeftContext());
			
			regExpJsniObj = new RegExpJsniImpl( "[a-z]e", false, false, false);
				assertTrue( regExpJsniObj.test( inputStr));
				assertEquals( "", regExpJsniObj.getLeftContext());
				assertTrue( regExpJsniObj.test( inputStr));
				assertEquals( "", regExpJsniObj.getLeftContext());
				
			regExpJsniObj = new RegExpJsniImpl( "[0-9]", false, true, false);
				assertFalse( regExpJsniObj.test( inputStr));
				assertEquals( "", regExpJsniObj.getLeftContext());
			
			regExpJsniObj = new RegExpJsniImpl( "(x|t)$", false, false, false);
				assertTrue( regExpJsniObj.test( inputStr));
				assertEquals( "testGetLeftContex", regExpJsniObj.getLeftContext());
	}
	
	public void testStaticGetLeftContext() {
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
//		regExpObj = RegExpJsni.getRegExp( "\\bfunction\\b", false, true);
		regExpObj = RegExpJsniImpl.getRegExp( "\\bfunction\\b", false, false);
		assertTrue( RegExpJsniImpl.test( regExpObj, inputStr));
		
		assertEquals( 
				inputStr.substring( 0, inputStr.indexOf( "function")), 
				RegExpJsniImpl.getLeftContextProperty()
				);
	}
	
	public void testGetRightContext() {
		inputStr = "testGetRightContext";
		regExpJsniObj = new RegExpJsniImpl( "t[A-Z]", false, true, false);
			int counter = 0;
			String rightContext = null;
			for( 
					String matchedStr = regExpJsniObj.exec( inputStr);
					matchedStr != null;
					matchedStr = regExpJsniObj.exec( inputStr)
					) 
			{
				counter++;
				rightContext = regExpJsniObj.getRightContext();
				assertEquals( 
						inputStr.substring( regExpJsniObj.getLastIndex()), 
						rightContext);
			} // for
			assertEquals( 3, counter);
			
		RegExpJsni regExpJsniObj2 = new RegExpJsniImpl( "[0-9]", false, true, false);
			assertFalse( regExpJsniObj2.test( inputStr));
			assertEquals( "", regExpJsniObj2.getRightContext());
			assertEquals( rightContext, regExpJsniObj.getRightContext());
		
		regExpJsniObj = new RegExpJsniImpl( "[a-z]t$", false, false, false);
			assertTrue( regExpJsniObj.test( inputStr));
			assertEquals( "", regExpJsniObj.getRightContext());
			assertTrue( regExpJsniObj.test( inputStr));
			assertEquals( "", regExpJsniObj.getRightContext());
			
		regExpJsniObj = new RegExpJsniImpl( "[0-9]", false, true, false);
			assertFalse( regExpJsniObj.test( inputStr));
			assertEquals( "", regExpJsniObj.getRightContext());
			
		regExpJsniObj = new RegExpJsniImpl( "^(t|e)", false, false, false);
			assertTrue( regExpJsniObj.test( inputStr));
			assertEquals( "estGetRightContext", regExpJsniObj.getRightContext());
	}
	
	public void testStaticGetRightContext() {
		inputStr = 
			"< script type=\"text/javascript\">" +
			"(function(){}).constructor( 'alert(\"Gotcha!\");')(); " +
			"var foo={message:'Gotcha!'}; (function(){alert(this.message)}).apply(foo,[]);" +
			"</script>";
//		regExpObj = RegExpJsni.getRegExp( "\\bfunction\\b", false, true);
		regExpObj = RegExpJsniImpl.getRegExp( "\\bfunction\\b", false, false);
		assertTrue( RegExpJsniImpl.test( regExpObj, inputStr));
		
		assertEquals( 
				inputStr.substring( inputStr.indexOf( "function") + "function".length()), 
				RegExpJsniImpl.getRightContextProperty()
				);
	}
	
	public void testGetMultiline() {
		inputStr = "testGetMultiline\r\nestGetMultilinet\r\nstGetMultilinete";
			regExpJsniObj = new RegExpJsniImpl( "(^t.|.e$|^e.|.t$)", false, true, true);
				assertTrue( regExpJsniObj.getMultiline());
				int counter = 0;
				String lastMatch = null;
				String leftContext = null;
				String rightContext = null;
				for( 
						String matchedStr = regExpJsniObj.exec( inputStr);
						matchedStr != null;
						matchedStr = regExpJsniObj.exec( inputStr)
						) 
				{
					counter++;
					lastMatch = matchedStr;
					leftContext = regExpJsniObj.getLeftContext();
					assertEquals( 
							inputStr.substring( 0, (regExpJsniObj.getLastIndex()-matchedStr.length())), 
							leftContext);
					rightContext = regExpJsniObj.getRightContext();
					assertEquals( 
							inputStr.substring( regExpJsniObj.getLastIndex()), 
							rightContext);
				} // for
				assertEquals( 5, counter);
				assertEquals( lastMatch, regExpJsniObj.getLastMatch());
				assertEquals( leftContext, regExpJsniObj.getLeftContext());
				assertEquals( rightContext, regExpJsniObj.getRightContext());
				
			regExpJsniObj = new RegExpJsniImpl( "(^t.|.e$|^e.|.t$)", false, true, false);
				assertFalse( regExpJsniObj.getMultiline());
				counter = 0;
				lastMatch = null;
				leftContext = null;
				rightContext = null;
				for( 
						String matchedStr = regExpJsniObj.exec( inputStr);
						matchedStr != null;
						matchedStr = regExpJsniObj.exec( inputStr)
						) 
				{
					counter++;
					lastMatch = matchedStr;
					leftContext = regExpJsniObj.getLeftContext();
					assertEquals( 
							inputStr.substring( 0, (regExpJsniObj.getLastIndex()-matchedStr.length())), 
							leftContext);
					rightContext = regExpJsniObj.getRightContext();
					assertEquals( 
							inputStr.substring( regExpJsniObj.getLastIndex()), 
							rightContext);
				} // for
				assertEquals( 2, counter);
				assertEquals( lastMatch, regExpJsniObj.getLastMatch());
				assertEquals( leftContext, regExpJsniObj.getLeftContext());
				assertEquals( rightContext, regExpJsniObj.getRightContext());
	}
	
	public void testStaticGetMultiline() {
		inputStr = "testStaticGetMultiline\r\nestStaticGetMultilinet\r\nstStaticGetMultilinete";
			regExpObj = RegExpJsniImpl.getRegExp( "(^t.|.e$|^e.|.t$)", false, true, true);
				assertTrue( RegExpJsniImpl.getMultiline( regExpObj));
				int counter = 0;
				String lastMatch = null;
				String leftContext = null;
				String rightContext = null;
				for( 
						String matchedStr = RegExpJsniImpl.exec( regExpObj, inputStr);
						matchedStr != null;
						matchedStr = RegExpJsniImpl.exec( regExpObj, inputStr)
						) 
				{
					counter++;
					lastMatch = matchedStr;
					leftContext = RegExpJsniImpl.getLeftContextProperty();
					rightContext = RegExpJsniImpl.getRightContextProperty();
					assertEquals( 
							inputStr.substring( 0, (RegExpJsniImpl.getLastIndex( regExpObj)-matchedStr.length())), 
							leftContext);
					assertEquals( 
							inputStr.substring( RegExpJsniImpl.getLastIndex( regExpObj)), 
							rightContext);
				} // for
				assertEquals( 5, counter);
				assertEquals( lastMatch, RegExpJsniImpl.getLastMatchProperty());
				assertEquals( leftContext, RegExpJsniImpl.getLeftContextProperty());
				assertEquals( rightContext, RegExpJsniImpl.getRightContextProperty());
				
			regExpObj = RegExpJsniImpl.getRegExp( "(^t.|.e$|^e.|.t$)", false, true, false);
				assertFalse( RegExpJsniImpl.getMultiline( regExpObj));
				counter = 0;
				lastMatch = null;
				leftContext = null;
				rightContext = null;
				for( 
						String matchedStr = RegExpJsniImpl.exec( regExpObj, inputStr);
						matchedStr != null;
						matchedStr = RegExpJsniImpl.exec( regExpObj, inputStr)
						) 
				{
					counter++;
					lastMatch = matchedStr;
					leftContext = RegExpJsniImpl.getLeftContextProperty();
					assertEquals( 
							inputStr.substring( 0, (RegExpJsniImpl.getLastIndex( regExpObj)-matchedStr.length())), 
							leftContext);
					rightContext = RegExpJsniImpl.getRightContextProperty();
					assertEquals( 
							inputStr.substring( RegExpJsniImpl.getLastIndex( regExpObj)), 
							rightContext);
				} // for
				assertEquals( 2, counter);
				assertEquals( lastMatch, RegExpJsniImpl.getLastMatchProperty());
				assertEquals( leftContext, RegExpJsniImpl.getLeftContextProperty());
				assertEquals( rightContext, RegExpJsniImpl.getRightContextProperty());
	}
	
}
